<?php
if (!defined('__COLA_DIR__')) exit;

/**
 * 相关内容组件(根据作者关联)
 *
 * @author edikud
 * @package Widget
 * @copyright Copyright (c) 2019 Cola (http://www.mcooo.com)
 * @license GNU General Public License 2.0
 */
class Widget_Contents_Related_Author extends Widget_Abstract_Contents
{
    /**
     * 执行函数,初始化数据
     *
     * @access public
     * @return void
     */
    public function execute()
    {
        $this->parameter->setDefault('limit=5');

        if ($this->parameter->author) {

			$this->select()
			->where('table.contents.type = ?', $this->parameter->type)
			->where('table.contents.uid = ?', $this->parameter->author)
            ->limit($this->parameter->limit)
            ->fetchAll(array($this, 'push'));

        }
    }
}
